Simplification of AMSMessage memory management#110
Conversation
…n correctly acked are stored into a hashmap to be resend later. Signed-off-by: Loic Pottier <pottier1@llnl.gov>
Signed-off-by: Loic Pottier <pottier1@llnl.gov>
|
I am not fully satisfied here, especially because void foo() {
AMSMessage msg (...);
// code here...
} // msg._data is not freed hereBut if you create a void foo() {
AMSMessage msg (...);
std::shared_ptr<uint8_t> ptr(msg.data());
} // msg._data is freed hereHowever, it is counterintuitive and not RAII. Ideally, |
|
@lpottier I further extended your logic. We now have a persistent map of unAck messages. This is implemented as a singleton. All threads can be aware at any time about these messages. It removes some of our logic in passing the AMSMessageRecords around. I also fixed the data race I pointed out earlier. |
This is valid. We should at some point fix this. Not in this PR as it sounds orthogonal. Can you post an issue? |
Signed-off-by: Loic Pottier <pottier1@llnl.gov>
This PRs simplify the memory management of AMSMessage by keeping track of what messages have not been acknowledged or never delivered. These messages are being re-send as soon as possible.
The bookkeeping is done by
AMSMessageRecords, a fine wrapper around astd::unordered_mapallowing safe concurrent accesses.Each message is recorded as a memory blob (shared pointer) and a size.
RMQInterfacecreate ashared_ptrof aAMSMessageRecordsand send a copy toRMQPublisherHandlerRMQPublisherHandlerwill then update AMSMessageRecordsRMQPublisherHandleris destroyed.RMQInterfacecreates a newRMQPublisherHandlerwith a new copy of the shared_ptr owning theAMSMessageRecords.